package org.csmzxy.class2334.stringclass;

public class Example07 {
    public static void main(String[] args){
        String id = "user";
        String time = "2023-1112-1336";
        String orderId = id.concat(time);
        System.out.println("将字符串" + time + "拼接到字符串" + id +"的末尾，" + "生成的订单号为" + orderId);
        System.out.println("截取字符串" + orderId + "的第5个字符到第14个字符，" + "结果为" + orderId.substring(4,13));
        System.out.println("将字符串" + time + "用符号-分割为若干个子字符串，结果为");
        String[] times = time.split("-");
        for (int i = 0;i < times.length; i ++){
            if (i != times.length -1){
                System.out.print(times[i] + ",");
            }else {
                System.out.println(times[i]);
            }
        }
    }
}
